package com.dubbo.goods.service;

import com.dubbo.goods.api.GoodsDubboService;
import com.dubbo.goods.domain.GoodsDTO;
import com.dubbo.goods.domain.GoodsDO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author goods
 * @create 2017-11-16 13:32
 */
@Service("goodsService")
public class GoodsServiceImpl implements GoodsService, GoodsDubboService {

    @Override
    public GoodsDTO findAllGoods() {
        GoodsDO goodsDO = new GoodsDO();
        goodsDO.setId(12L);
        goodsDO.setName("香蕉");
        goodsDO.setPrice(new BigDecimal(10));
        goodsDO.setDescription("山沟信息时代的");

        GoodsDTO goodsDTO = new GoodsDTO();
        BeanUtils.copyProperties(goodsDO, goodsDTO);
        return goodsDTO;
    }

    @Override
    public GoodsDTO findAllGoodsDubbo() {
        return findAllGoods();
    }
}
